[monad] Reserve balance precompile fallback cost#2109
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the gas cost for the reserve balance precompile's fallback method from 40,000 to 100, aligning it with the cost of the dippedIntoReserve method as specified by Monad Foundation. The previous value of 40,000 was a placeholder modeled after the staking contract.
Changes:
- Updated
FALLBACK_COSTconstant from 40,000 to 100 to match the specification - Restructured and enhanced test coverage to validate the new gas cost with both sufficient and insufficient gas scenarios
- Added explicit out-of-gas (OOG) test cases for both
fallbackanddippedIntoReservemethods
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| category/execution/monad/reserve_balance/reserve_balance_contract.cpp | Updated FALLBACK_COST constant from 40,000 to 100 |
| category/execution/monad/reserve_balance/reserve_balance_contract_test.cpp | Restructured fallback test with proper gas amounts (100 and 99); added OOG test for dippedIntoReserve method; corrected gas values in all related tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
74367e7 to
f6423fc
Compare
f6423fc to
945ab05
Compare
Monad Foundation has specified the cost of the `fallback` method on the reserve balance precompile should be a `100` (which is same as the `dippedIntoReserve` method). Previously, the cost was set to `40'000` (modelled after the staking contract's fallback method) as a placeholder value.
945ab05 to
3807751
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
category/execution/monad/reserve_balance/reserve_balance_contract_test.cpp
Outdated
Show resolved
Hide resolved
category/execution/monad/reserve_balance/reserve_balance_contract_test.cpp
Outdated
Show resolved
Hide resolved
category/execution/monad/reserve_balance/reserve_balance_contract.cpp
Outdated
Show resolved
Hide resolved
ced05b7 to
a37b706
Compare
This patch adds tests, which checks that the order of wellformedness checks for calling the reserve contract is consistent with the order specified by the Monad Foundation.
a37b706 to
3b7d52d
Compare
kkuehlz
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Monad Foundation has specified the cost of the
fallbackmethod on the reserve balance precompile should be a100(which is same as thedippedIntoReservemethod). Previously, the cost was set to40'000(modelled after the staking contract's fallback method) as a placeholder value.